#ifndef DASHBOARDCLIENT_H
#define DASHBOARDCLIENT_H
#include "Commands/Subsystem.h"
#include "WPILib.h"
#include "Robotmap.h"
#include "sockLib.h"
#include "hostLib.h"
#include "CommandBase.h"
#include "netdb.h"
#include <algorithm>
#include <sstream>
#include <string>
#define BUFFER_SIZE 256

/**
 *
 *
 * @author team308
 */
class DashboardClient {
private:
	static const char* dashIP;
	const static u_short dashPort = 1735;
	const static char hEOT = 4;
	
	int nwInt[256];
	float nwFloat[256];
	
	int n;
	int dashSocket;
	std::stringstream converter;
	std::string buffer;
	char tempbuff[BUFFER_SIZE];
	bool angleRequested;
//	char *nwbuffer;
	std::string nwbuffer;
	//Sync'd data

	void BlockReceived(size_t);
public:
	void SetNWInt(int, int);
	void SetNWFloat(int, float);
	int GetNWInt(int index);
	float GetNWFloat(int index);
	DashboardClient();
	void InitDefaultCommand();
	void PeriodicUpdate();
	void ConnectToDash();
	void DataReceived(char, std::string);
	float GetP();
	float GetI();
	float GetD();
	float GetAngle();
	
	float P,I,D;
	float dataAngle;
	
};

#endif
